var app = getApp();
Page({
  data: {
    UserInfo: {},
    isShowBtn: !1,
    isShowMag: !1,
    Level1Discount: 0,
    Level2Discount: 0,
  },
   onLoad: function (e) {
    var t = this;
    console.log(e);
    t.setData({
      UserInfo: app.globalData.userInfo
    });
    t.getPageInfo(e);
    if (app.check_empty(e.good_id)) {
      wx.setNavigationBarTitle({ title: "我要代言" })
    } else {
      wx.setNavigationBarTitle({ title: "我要推广" });
      t.setData({
        good_id: e.good_id
      });
    }
  },
  // onShareAppMessage: function () {
  //     this.setData({isShowMag: !1});
  //     var e, t, n;
  //     return app.check_empty(this.data.ProductInfo) ? (e = "/pages/endorsement/endorsement?uid=" + this.data.UserInfo.Id, t = this.data.UserInfo.nickName + "偷偷的告诉你，粉丝也能赚钱哦~") : (e = "/pages/goods-details/index/?parentid=" +good_id+ "&id=" + this.data.good_id , t = "我发现这个商品很好，非常适合你哦！"), {
  //         title: t,
  //         desc: t,
  //         path: e
  //     }
  // },
  previewlmg: function () {

    wx.previewImage({
      current: this.data.qrcodea, // 当前显示图片的http链接
      urls: [this.data.qrcodea] // 需要预览的图片http链接列表
    })

  },
  getPageInfo: function (e) {
    var t = this;
    
    if (e.good_id) {
      app.ajax(app.ceport.create_qrcode_good, { rd_session: wx.getStorageSync('rd_session'), good_id: e.good_id }, function (res) {
        console.log(res);
        t.setData({
          Level1Discount: res.data.data.level1,
          Level2Discount: res.data.data.level2,
          qrcodea: res.data.data.qrcode
        });

      })
    } else {
      app.ajax(app.ceport.create_qrcode, { rd_session: wx.getStorageSync('rd_session') }, function (res) {
        console.log(res);
        t.setData({
          Level1Discount: res.data.data.level1,
          Level2Discount: res.data.data.level2,
          qrcodea: res.data.data.qrcode
        });

      })
    }


  }, 
  closeMsk: function () {
    this.setData({ isShowMag: !1 })
  }
});